<include file="Public/head"/>
<link href="__CSS__/bootstrap.min.css" rel="stylesheet">
<link href="__CSS__/bootstrap.css" rel="stylesheet">
<link href="__CSS__/logined.css" rel="stylesheet">
<script src="https://cdn.bootcss.com/jquery/1.12.3/jquery.min.js"></script>
<!--<script src="__JS__/layer/layer.js"></script>-->
<script src="__PUBLIC__/lib/layer/layer.js"></script>
<style type="text/css">
    .getCode {
        display: inline-block;
        width: 40%;
        text-align: right;
        color: #181b43;
    }
    body{
        background: #fff;
    }
    .container{
        width: 6rem;
        padding: 0;
    }
    .form-control2{
        /*width:20%;*/
        border: none;
        outline: none;
        background:transparent;
        display: block;
        height: 34px;
        font-size: 14px;
        line-height: 1.42857143;
        color: #555;
        float: right;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        background:url('__IMG__/ex/down.png') no-repeat scroll right center transparent;
        background-size: 20% 40%;
        padding-right: 14px;
    }
    .title1{
        position: absolute;
        background: #fff;
        border-bottom: 2px solid #F1F3F4;
    }
    input::-webkit-input-placeholder { /* WebKit browsers 适配谷歌 */
        color: #dedede !important;
    }
    .inputys{background-color:rgba(255,255,255,0); height:40px;outline: none; border:0px; color:#333;width:70%;border:none !important;}
</style>


<body>
<div class="title1" >
    <div class=" col-xs-4" style="text-align:left;width: 0;">
        <!--<a href="javascript:history.go(-1)" style="color:#333">-->
        <a href="{:U('Index/index')}" style="color:#333;">
            <!--                <span class="glyphicon glyphicon-menu-left" aria-hidden="true" style="color: #fff;"></span>-->
            <img src="__IMG__/ex/back_black.png" alt="" width="10rem">
        </a>
    </div>
    <div class=" col-xs-4" style="text-align: left;color: #000;font-size: .3rem;line-height: .55rem"> 转账</div>
    <div class=" col-xs-4"  style="text-align: right;float: right;font-size: .3rem;line-height: .55rem"><a href="{:U('Finance/history')}" style="color:#000;">记录</a></div>
</div>

<div class="container" style=" padding-top:40px;">

    <!--         <div class="row-fluid qk" >
                <div style=" height:50px; line-height:50px; font-size:16px; ">
                    <div style=" float:left; padding-left:15px;"><img src="__IMG__/B.png" width="30" /></div>
                    <div style="float:left; width:45%; padding-left:15px; color:#FFF;">
                        BTC
                    </div>

                    <div style=" float:right; padding-right:15px; text-align:right; color:#475377;">
                        <span class="glyphicon glyphicon-menu-right" aria-hidden="true"></span>
                    </div>
                </div>
            </div> -->

    <div class="row-fluid qk" >

        <div class="choose" style=" height:40px;">
            <div class="col-xs-4 t3 tips" style=" float:left; height:40px; line-height:67px; padding-left:15px; color:#000;">可用(USDT)</div>
            <div class="col-xs-4 t3" style=" float:right;text-align: right; height:40px; line-height:67px; padding-left:15px; color:#A9A9A9;padding-right: 0">选择币种</div>
        </div>

        <div class="choose" style=" height:40px;">
            <div class="col-xs-4 t3 use_money" style=" float:left; height:40px; line-height:40px; padding-left:15px; color:#000;" >{$accountBalance}</div>

            <select class="form-control2" style="float: right;" id="coinname" onclick="role()">
                <!--<select name="" id="charge">-->
                <option value="8">USDT</option>
                <option value="2">DACM</option>
            </select>
            <img src="__IMG__/ex/USDT.png" id="USDT" alt="" width="20rem" style="display: inline;float: right;line-height: 1rem;margin: .1rem;">
            <img src="__IMG__/ex/exlogo1.png" id="DACM" alt="" width="20rem;" style="display: none;float: right;line-height: 1rem;margin: .1rem;">
        </div>

        <div class="line1"></div>

        <div style=" height:40px;">
            <div class="col-xs-4 t3" style=" float:left; height:40px; line-height:40px; padding-left:15px; color:#000;"> 对方UID</div>
            <div class="col-xs-8" style=" float:left; height:40px; line-height:40px;">
                <input type="text" id="account" placeholder="请输入" class="inputys" >
            </div>
        </div>
        <div class="line1"></div>

        <!--<div style=" height:40px;" >-->
        <!--<div class="col-xs-4 t3" style=" float:left; height:40px; line-height:40px; padding-left:15px; color:#000;">手机号</div>-->
        <!--<div class="col-xs-8" style=" float:left; height:40px; line-height:40px;">-->
        <!--<input type="text" id="phone" readonly class="inputys" style="color: red;"/>-->
        <!--</div>-->
        <!--</div>-->
        <div style=" height:40px;" >
            <div class="col-xs-4 t3" style=" float:left; height:40px; line-height:40px; padding-left:15px; color:#000;">邮箱</div>
            <div class="col-xs-8" style=" float:left; height:40px; line-height:40px;">
                <input type="text" id="email" readonly class="inputys" style="color: red;"/>
            </div>
        </div>
        <!--<div style=" height:40px;" >-->
            <!--<div class="col-xs-4 t3" style=" float:left; height:40px; line-height:40px; padding-left:15px; color:#000;">UID</div>-->
            <!--<div class="col-xs-8" style=" float:left; height:40px; line-height:40px;">-->
                <!--<input type="text" id="uid" readonly class="inputys" style="color: red;"/>-->
            <!--</div>-->
        <!--</div>-->
        <div class="line1"></div>
        <span style="color: #EC1C24;padding-left:.2rem;font-size: .2rem;">
                    <img src="__IMG__/tt.png" width="12" height="12"  />&nbsp;转账前请务必确认对方账号信息无误!转出不可撤回!
                </span>
        <div style=" height:40px;">
            <!--<div class="col-xs-4 t3" style=" float:left; height:50px; line-height:50px; padding-left:15px;"> {:L('_GBCSL_')}</div>  -->
            <div class="col-xs-4 t3" style=" float:left; height:40px; line-height:40px; padding-left:15px;"> 数量</div>
            <div class="col-xs-12" style=" float:left; height:40px; line-height:40px;display: flex;justify-content: space-between;padding-right:.1rem">
                <!--<input type="text" id="amount" placeholder="{:L('_SRSL1_')} " class="inputys" >-->
                <input type="text" id="amount" placeholder="请输入转出数量（不低于{$config.p97}）" class="inputys" autocomplete="off" style="width:100%;"/>
                <span style="color: #EC1C24;font-weight:bold;width: 1rem;text-align: right" class="all_btn">全部</span>
            </div>
        </div>
        <div class="line1"></div>

        <div class="line1"></div>

        <!--<div style=" height:50px;">-->
        <!--<div class="col-xs-4" style="  height:50px; line-height:50px;  color:#475377;">{:L('_ZHYE_')}:</div>  -->
        <!--<div class="col-xs-8" style=" height:50px; line-height:50px; color:#fff; font-size:18px;">-->
        <!--{$userData['reward1']} GBC-->
        <!--</div>-->
        <!--</div>-->

        <div style=" height:40px;float: right;text-align: right;width:100%">
            <div class=" t3" style=" float: right; height:40px; line-height:40px; width: 4rem;; color:#000;width:100%;display:flex;align-items:center;justify-content:space-between">
                <div id="" style="text-align: left;padding-left:15px">
                    账户余额:
                    <input type="text" style="width:42%" id="balance"  onkeydown="this.onkeyup();" onkeyup="this.size=(this.value.length>4?this.value.length:4);" size="4"  value="{$accountBalance}" placeholder="" class="inputys" disabled>
                </div>
                <span style="font-size:.24rem;color:#9A9A9A">矿工费:&nbsp;{$configData.a54} DACM</span>
            </div>
            <div id="" style="float:left;margin:10px 0 10px 15px;">

            </div>
            <!--                <div class="col-xs-8" style=" float:left; height:40px; line-height:40px;">-->
            <!--                    &lt;!&ndash;<input type="text" id="address" placeholder="{:L('_SRCZDZ_')}" class="inputys" >&ndash;&gt;-->
            <!--                    &lt;!&ndash;<input type="text" id="balance" value="{$accountBalance}" placeholder="" class="inputys" disabled>&ndash;&gt;-->
            <!--                    <input type="text" id="balance" value="{$accountBalance}" placeholder="" class="inputys" disabled>-->
            <!--                </div>-->
        </div>
    </div>

    <!--<div style=" color:#475377; margin-top:15px;">-->
    <!--<img src="__IMG__/tt.png" width="18" height="18"  />-->
    <!--{:L('_TS5_')}{$configData['canshu1']} GBC {:L('_TS6_')}-->
    <!--</div>-->
    <!--       <div style=" color:#475377; margin-top:15px;">
              <img src="__IMG__/tt.png" width="18" height="18"  />
              BTC当前价格：{$btcPrice} USDT。
          </div>   -->
    <!--            <div style=" color:#475377; margin-top:15px;">-->
    <!--                <img src="__IMG__/tt.png" width="18" height="18"  />-->
    <!--                &lt;!&ndash;{:L('_GBCYSJG_')}：1GBC = 1CNY。&ndash;&gt;-->
    <!--                手续费<span id="charge"></span>%-->

    <!--            </div> -->
    <div style=" margin-top:80px;">
        <button id="btn-1"> 确认 </button>
    </div>

</div>
<input type="hidden" id="p96" value="{$config.p96}"/>

<input type="hidden" id="ptr67" value="{$config.ptr67}"/>
<input type="hidden" id="ptr75" value="{$config.ptr75}"/>
<!--EASY手续费-->
<input type="hidden" id="ptr76" value="{$config.ptr76}"/>
</body>
<style>
    .change-gray {
        color: #999;
    }
</style>
</html>

<!-- <script type="text/javascript">
    $("#amount").bind('input propertychange',function(){
        var fee = "{$configData['canshu1']}";
        var amount = $("#amount").val();
        var btc = "{$btcPrice}";
        var count= (amount - fee) / btc;
        $("#btc").val(count.toFixed(8));    
    });
</script> -->
<script type="text/javascript" src="__JS__/web3.1.js"></script>
<script type="text/javascript">
    var max_transfer = "{$max}"
    $(".all_btn").click(function () {
        let money= $("#balance").val();
        // $("#amount").val(money);
        alert('最大可转'+max_transfer)
        $("#amount").val(max_transfer);
    });

    $('#amount').change(function(){
        $('#real_amount').val($(this).val()*(100-'{$sxf}')/100);
    });

    $("#account").blur(function () {
        let account=$(this).val();
        // console.log(account);return false;
        $.post("{:U('Account/getUser')}",{name:account},function(data){
            // if(data.code>0){
            //     $("#phone").val(data.msg);
            $("#email").val(data.msg);
            // }
            console.log(data);
        },'json');
    })
    // let val1=$("#ptr73").val();
    let val1=$("#p96").val();
    $("#charge").text(parseFloat(val1)*100);
    $('#coinname').change(function(){
        var coinname = $("#coinname").val();

        // if (coinname==='2'){
        //     let val2=$("#ptr67").val();
        //     $("#charge").text(parseFloat(val2)*100);
        // }
        // if (coinname==='3'){
        //     let val3=$("#ptr75").val();
        //     $("#charge").text(parseFloat(val3)*100);
        // }
        // if (coinname==='5'){
        //     let val5=$("#ptr76").val();
        //     $("#charge").text(parseFloat(val5)*100);
        // }
        // console.log(coinname);
        //传输数据
        $.ajax({
            type : 'POST',
            url:"{:U('Finance/getBalance')}",
            dataType : 'json',
            data:{
                coinname:coinname,
            },
            success : function(data){

                if(data.code == 1){
                    //alert(data.msg);
                }else
                {
                    $("#balance").val(data.data);
                    $(".use_money").text(data.data);
                    $(".tips").text('可用('+$("#coinname option:selected").text()+')');
                    max_transfer = Math.floor(data.data/(1+parseFloat(val1)));
                }
            }
        })
    });
</script>

<script type="text/javascript">
    $("#send_email").click(function(){
        var num=59;
        var that=$(this);
        //判断是否已经发送验证码
        if($(this).hasClass('change-gray'))
        {
            layer.msg("{:L('_WCF_')}",{time:1000});
            return;
        }
        // var mail = $('#mail').val();
        var mail = "{$userData['username']}";
        if(mail == '')
        {
            layer.msg("{:L('_SRSJH_')}",{time:1000});
            return false;
        }
        $.ajax({
            type : 'POST',
            url: "{:U('Public/send_email')}",
            dataType: 'json',
            data:{
                mail: mail,
            },
            success : function(data){
                var timer=setInterval(function(){
                    that.attr('id','');
                    that.text(num+'s');
                    that.addClass('active');
                    num--;
                    if(num==0){
                        that.attr('id','send_email');
                        clearInterval(timer);
                        that.text('重新发送');
                    }
                },1000);
                $(".getCode").attr("disabled",true).css("pointer-events","none");

                if(data.code > 0)
                {
                    layer.msg(data.message,{time:1000});
                }else
                {
                    layer.msg(data.message,{time:1000});
                }
            }
        })
    });
    $("#send_message").click(function(){
        var num=59;
        var that=$(this);
        var mobile = "{$userData['username']}";

        $.ajax({
            type : 'POST',
            url: "{:U('Public/send_msg')}",
            dataType: 'json',
            data:{
                mobile: mobile,
            },
            success : function(data){
                var timer=setInterval(function(){
                    that.attr('id','');
                    that.text(num+'s');
                    that.addClass('active');
                    num--;
                    if(num==0){
                        that.attr('id','send_message');
                        clearInterval(timer);
                        that.text('重新发送');
                    }
                },1000);
                $(".getCode").attr("disabled",true).css({"pointer-events":"none","width":"35%"});

                if(data.code > 0)
                {
                    layer.msg(data.message,{time:1000});
                }else
                {
                    layer.msg(data.message,{time:1000});
                }
            }
        })
    });

    function role(){
        var sel1 = document.getElementById('coinname');
        var index = sel1.selectedIndex;
        var value=sel1.options[index].value;
        console.log(value);
        if(value==8){
            $('.choose img').css('display','none');
            $('#USDT').css('display','inline');
            $('#USD').css('display','inline')
        }else {
            $('.choose img').css('display','none');
            $('#DACM').css('display','inline');
            $('#USD').css('display','inline')
        }
        // var price = $("#selectid option:selected").attr('price')
        // console.log(price)
        // $("#price").text(price)
        // $("#after").text('0.00')
        // $("#from_num").val('')
    }

</script>

<script type="text/javascript">


    $('#btn-1').click(function(){
        layer.confirm("确定转出吗？",function () {
            //生成BTC地址
            var coinname = $("#coinname").val();
            var account = $("#account").val();

            var amount = $("#amount").val();
            var password = $("#password").val();
            // var phone = $("#phone").val();
            // 20191112
            // var type = "{$userData['type']}";
            // if(type=='1'){
            //     var getCode = $("#code").val();
            // }else{
            //     var getCode = $("#code2").val();
            // }
            //
            // if(getCode===''){
            //     layer.msg("请填写验证码");return false;
            // }
            // if(account===''){
            //     layer.msg("请填写对方账号");return false;
            // }
            //传输数据
            $.ajax({
                type : 'POST',
                url:"__ACTION__",
                // url:"{:U('Property/zhuanzhang')}",
                dataType : 'json',
                data:{
                    coinname:coinname,
                    account:account,
                    amount:amount,
                    password:password,
                    // phone:phone,
                    // getCode:getCode
                },
                success : function(data){

                    if(data.code == 1){
                        layer.msg(data.msg,{time:1000});
                        return false;
                        // alert(data.msg);
                        //setTimeout(function(){ window.location.reload(); }, 1000);
                    }else
                    {
                        layer.msg(data.msg,{time:1000});
                        // alert(data.msg);
                        // setTimeout(function(){ window.location.href="{:U('Finance/history',['type'=>4])}"; }, 1000);
                        setTimeout(function(){ window.location.href="{:U('Finance/history')}"; }, 1000);
                    }
                }
            })
        });

    });

</script>
